module.exports = app => {
  const { router, controller } = app;
  const jwt = app.middleware.jwt({}, app); // 传递空配置对象和app实例
  router.get('/api/', jwt, controller.home.index);
  router.post('/api/user/register', controller.user.register);
  router.post('/api/login', controller.user.login);
  router.post('/api/user/change-password', jwt, controller.user.changePassword); // 修改密码

  // 文章相关路由
  router.post('/api/articles', jwt, controller.article.create); // 创建文章
  router.post('/api/articles/:id/delete', jwt, controller.article.destroy); // 删除文章
  router.post('/api/articles/:id/update', jwt, controller.article.update); // 更新文章
  router.get('/api/articles/:id', controller.article.show); // 获取单个文章
  router.get('/api/articles', controller.article.index); // 获取文章列表
}
